from config import upload_path
from .file_view import FileProcessView, FileUploadView, RptGenerateView
from .sql_view import SQLView
from app import db
from app.models import FileProcessor, SQLProcessor, RptGenerator
from config import upload_path


def add_views(sys_admin):
    sys_admin.add_category('数据处理', icon_type='fa', icon_value='fa-table')
    sys_admin.add_view(FileUploadView(upload_path, '/uploads/', name='数据文件上传', category='数据处理',
                                      menu_icon_type='fa', menu_icon_value='fa-upload'))
    sys_admin.add_view(FileProcessView(FileProcessor, db.session, name='数据文件处理', category='数据处理',
                                       menu_icon_type='fa', menu_icon_value='fa-clock-o'))
    sys_admin.add_view(RptGenerateView(RptGenerator, db.session, name='报表数据生成', category='数据处理',
                                       menu_icon_type='fa', menu_icon_value='fa-flask'))
    sys_admin.add_view(SQLView(SQLProcessor, db.session, name='SQL脚本执行', category='数据处理',
                                       menu_icon_type='fa', menu_icon_value='fa-database'))
